using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Text.RegularExpressions;
using System.Data;
using System.IO;
using System.Threading;
using System.Globalization;
namespace Test {
	class DirCust {


		static void MainX() {
			Thread.CurrentThread.CurrentCulture=new CultureInfo(1053,false);
			DAL dir=new DAL("pon-wpsq16-db","directory");
			DAL loc=new DAL(".","sale");
			DataTable tab=dir.Query(@"select convert(char(10),CreatedDate,120)[day],CustomerNumber,count(*)[count] 
from dirParcel(nolock)where datediff(day,CreatedDate,getdate())=1 group by convert(char(10),CreatedDate,120),CustomerNumber order by 2");

			foreach(DataRow row in tab.Rows)
				loc.NonQry("insert into CustOrd(dat,cn,qty)values('{0}','{1}',{2})",row[0],row[1],row[2]);
			Console.WriteLine("end");
			//if(tab.Rows.Count>0)
			//DAL.Csv(tab,"C:\\Dir.csv");
		}
	}
}
//create database sale
//create table CustOrd(id int identity primary key,inserted datetime default getdate(),cn char(8),dat date,qty int)

